package com.linsir.core.dict;

import com.linsir.aop.AopContext;
import com.linsir.aop.MetaObjectIntercept;
import com.linsir.common.utils.xx;
import com.linsir.model.MetaObject;

/**
 * @author yuxiaolin
 * @title: DictIntercept
 * @projectName linsir-mu
 * @description: TODO
 * @date 2021/12/3 4:20 PM
 */

public class DictIntercept extends MetaObjectIntercept {

    @Override
    public void queryBefore(AopContext ac) throws Exception {
        String objectCode = ac.ctrl.getPara("query_v_object_code");
        if (!xx.isEmpty(objectCode)) {
            MetaObject o = MetaObject.dao.getByCode(objectCode);
            ac.condition = " and object = ?";
            ac.params.add(o.getTable());
        }

        super.queryBefore(ac);
    }
}
